package net.kucoe.grin.context;

import java.util.List;

/**
 * Context holding class.
 * 
 * @author Vitaliy Basyuk
 */
public class Context {
    
    private List<ContextSystem> systems;
    
    /**
     * Returns the systems List<ContextSystem>.
     * 
     * @return the systems List<ContextSystem>.
     */
    public List<ContextSystem> getSystems() {
        return systems;
    }
    
    /**
     * Overrides systems the systems.
     * 
     * @param systems the systems to set.
     */
    public void setSystems(final List<ContextSystem> systems) {
        this.systems = systems;
    }
    
    /**
     * Starts context execution.
     */
    public void start() {
        if (systems == null || systems.isEmpty()) {
            throw new RuntimeException("Initial systems are not defined");
        }
        for (ContextSystem system : systems) {
            system.initializeSystem();
        }
    }
    
}
